import Layout from '@/layout/index.vue'
import Home from '@/views/homePage/index.vue'

export const basicRoutes = [
  {
    path: '/login',
    title: 'Login',
    component: () => import('@/views/login/index.vue'),
    isHidden: true,
    meta: {
      title: '登录页'
    }
  },
  {
    path: '/',
    title: '系统首页',
    component: Layout,
    redirect: '/home',
    menuIcon: 'HomeSharp',
    meta: {
      title: '系统首页',
      hideChild: true
    },
    children: [
      {
        path: 'home',
        title: 'Home',
        component: Home,
        meta: {
          title: '系统首页',
          affix: true
        }
      }
    ]
  }
]

export const NOT_FOUND_ROUTE = {
  title: 'NOT_FOUND',
  path: '/:pathMatch(.*)*',
  redirect: '/404',
  isHidden: true
}

export const REDIRECT_ROUTE = {
  path: '/redirect',
  title: 'Redirect',
  component: Layout,
  meta: {
    title: 'Redirect',
    hideBreadcrumb: true
  },
  children: [
    {
      path: '/redirect/:path(.*)',
      name: 'Redirect',
      component: () => import('@/views/redirect/index.vue'),
      meta: {
        title: 'Redirect',
        hideBreadcrumb: true
      }
    }
  ]
}

const modules = import.meta.globEager('./modules/*.js')
const asyncRoutes = []
Object.keys(modules).forEach((key) => {
  asyncRoutes.push(...modules[key].default)
})

export { asyncRoutes }
